<template>
  <div class="about">
    <van-nav-bar
      title="关于我们"
      left-text="返回"
      left-arrow
      @click-left="$router.go(-1)"
    />
    <div class="container">
      <div class="icon" @click="handlerHiddenInfo">
        <img :src="resources.logo" alt="" />
      </div>
      <div class="version">v{{ version }}</div>
      <div class="copyright">版权所有：© 2025 pear</div>
      <div class="email">邮箱：1144626780@qq.com</div>
    </div>
    <div class="disclaimer">
      <p>免责声明</p>
      <p>1、本软件仅供学习交流使用，请勿用于商业用途！</p>
      <p>
        2、本软件不提供任何形式的担保，包括但不限于适销性、适用于特定用途和非侵权的担保。
      </p>
      <p>
        3、用户在使用本软件时，应自行承担相应的风险，并自行承担因使用本软件而导致的任何直接或间接的损失。
      </p>
    </div>
    <div class="private-info" v-show="showPrivateInfo">
      <div class="title">-- 欢迎合作--</div>
      <div class="contact">
        <div class="qq">
          <img :src="resources.qcQQ" alt="" />
          <span>QQ</span>
        </div>
        <div class="wechat">
          <img :src="resources.qcWechat" alt="" />
          <span>WeChat</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { Toast } from "vant";
import { getList } from "@/api/mobile/resources";
export default {
  name: "AboutView",
  data() {
    return {
      resources: {},
      count: 8,
      timer: null,
      showPrivateInfo: false,
    };
  },
  computed: {
    version() {
      return process.env.VERSION;
    },
  },
  created() {
    this.getResources();
  },
  methods: {
    async getResources() {
      const res = await getList();
      this.resources = res.data;
    },
    handlerHiddenInfo() {
      if (this.showPrivateInfo) {
        Toast("已开启隐私信息");
        return;
      }
      clearTimeout(this.timer);
      if (this.count <= 0) {
        Toast("已开启隐私信息");
        this.showPrivateInfo = true;
      } else {
        if (this.count <= 5) {
          Toast(`再点${this.count}次开启隐私信息`);
        }
        this.count--;
      }
      this.timer = setTimeout(() => {
        this.count = 8;
      }, 800);
    },
  },
};
</script>
<style lang="less" scoped>
.about {
  min-height: 100vh;
  .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
    color: #333;
    .icon {
      width: 70px;
      height: 70px;
      border-radius: 14px;
      box-shadow: 0 0 4px #ccc;
      img {
        width: 100%;
        height: 100%;
        border-radius: inherit;
      }
    }
    .version {
      margin-top: 10px;
    }
    .copyright {
      margin-top: 10px;
    }
    .email {
      margin-top: 10px;
    }
  }
  .disclaimer {
    margin-top: 20px;
    padding: 0 14px;
    color: #666;
    p {
      margin: 0;
      padding: 0;
      font-size: 14px;
      line-height: 1.5;
    }
  }
  .private-info {
    .title {
      height: 50px;
      line-height: 50px;
      text-align: center;
      font-size: 18px;
      font-weight: 500;
      letter-spacing: 2px;
    }
    .contact {
      display: flex;
      justify-content: space-around;
      .qq,
      .wechat {
        width: 120px;
        height: 120px;
        display: flex;
        flex-direction: column;
        align-items: center;
        img {
          width: 90%;
          height: 90%;
          border-radius: 6px;
        }
        span {
          margin-top: 10px;
        }
      }
    }
  }
}
</style>